<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
      xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions">
<head>
  <f:metadata>
  	<f:event type="preRenderView" listener="#{livroMB.initialize}"/>
  </f:metadata>
  <title><ui:insert name="title">Biblioteca Pessoal</ui:insert></title>
</head>

<body>
<ui:debug hotkey="x" rendered="#{initParam['javax.faces.FACELETS_DEVELOPMENT']}"/>

<div id="header">
    <ui:insert name="header">
    	<h2>Biblioteca de <h:outputText value="#{livroMB.usuario.nome}"></h:outputText></h2>
    	
    	
    	<!--  include your header file or uncomment the include below and create header.xhtml in this directory -->
    	<!-- <ui:include src="header.xhtml"/> -->
    </ui:insert>
</div>


<div id="content">
  <ui:insert name="content">
    	
    	<h:dataTable border="1" value="#{livroMB.livros}" var="livro" rendered="#{!empty livroMB.livros}">
			<h:column>
				<f:facet name="header">
					<h:outputText value="Nome do livro"></h:outputText>
				</f:facet>
				<h:outputText value="#{livro.titulo}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="ISBN"></h:outputText>
				</f:facet>
				<h:outputText value="#{livro.isbn}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Ano de publicação"></h:outputText>
				</f:facet>
				<h:outputText value="#{livro.anoPub}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Usuário"></h:outputText>
				</f:facet>
				<h:outputText value="#{livro.usuario.nome}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Autores"></h:outputText>
				</f:facet>
				<h:outputText value="#{livro.listaAutores}"></h:outputText>
			</h:column>
		</h:dataTable>
    	
    	<!--  include your content file or uncomment the include below and create content.xhtml in this directory -->
	  	<!-- <div> -->
    	<!-- <ui:include src="content.xhtml"/> -->  
    	<!-- </div> -->
  </ui:insert>
</div>

<div id="footer">
  <ui:insert name="footer">
    	
    	<!--  include your header file or uncomment the include below and create footer.xhtml in this directory -->
		<!--<ui:include src="footer.xhtml"/>  -->
  </ui:insert>
</div>

</body>

</html>
